Frontier state reads as structure, not a wall of collapsed JSON - #108
Merged
Conversation
The compacted working set was rendered as JSON.stringify(state, null, 1) dropped straight into a <div>. The indentation produced newlines, HTML collapsed every one of them, and the result was a single unbroken slab of monospace — on a phone, most of a screen of it, braces and quotes and all. Now the structure is rendered: keys become labels, values become prose. Nested objects indent behind a rail and their keys read smaller, so hierarchy survives. Long strings (the agent-written prose that makes up most of a frontier) get the reading face; short scalars — ids, counts, flags — keep the terminal one. Arrays of scalars join onto one line rather than becoming a column of one-word rows. The keys are unknowable by design — an agent writes this via state_update — so the renderer is generic rather than keyed to any particular shape, with a depth bound that falls back to raw JSON rather than recursing forever. A "Raw JSON" toggle keeps the exact payload one click away, in a <pre> so its newlines actually survive this time. Checked against the real firstproof-c4 state and eleven edge shapes: nested objects, arrays of scalars and of objects, empty object/array, null, booleans, numbers, unicode, embedded newlines, >5-deep nesting, and an injection attempt (escaped correctly). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QQgFEPRY4W74D4eqawQ4A6
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #107 (this commit was pushed to that branch just after it merged, so it needs its own PR).
The compacted working set was rendered as
JSON.stringify(state, null, 1)dropped straight into a<div>. The indent argument produced newlines — and HTML collapsed every one of them. The result was a single unbroken slab of monospace with the braces and quotes still in it; on a phone, most of a screen of it before you reach anything else.Before (real
firstproof-c4state, as shipped):After — keys become labels, values become prose:
Nested objects indent behind a rail and their keys render smaller, so hierarchy survives more than one level. Long strings — the agent-written prose that is most of any frontier — get the reading face; short scalars (ids, counts, flags) keep the terminal one. Arrays of scalars join onto one line instead of becoming a column of one-word rows.
The keys are unknowable by design (an agent writes this via
state_update), so the renderer is generic rather than keyed to any particular shape, with a depth bound that falls back to raw JSON rather than recursing forever.A Raw JSON toggle keeps the exact payload one click away — in a
<pre>this time, so its newlines survive.Testing
Rendered the real
firstproof-c4state plus eleven edge shapes: nested objects, arrays of scalars and of objects, empty object, empty array, null, booleans, numbers, unicode, embedded newlines, >5-deep nesting, and an injection attempt — which escapes correctly (<img src=x onerror=…>).Site-only, so no version bump: the CLI bundle is untouched and this ships via the Deploy workflow on merge.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QQgFEPRY4W74D4eqawQ4A6